package com.zijie.hosptal.config;

import com.zijie.hosptal.common.Result;
import com.zijie.hosptal.exception.*;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalException {
    @ExceptionHandler
    public Result<?> error(MaxException e) {
        return Result.fail(e.getMessage());
    }
    @ExceptionHandler
    public Result<?> error(RepeatedDay e) {
        return Result.fail(e.getMessage());
    }
    @ExceptionHandler
    public Result<?> error(RepeatDeptException e) {
        return Result.fail(e.getMessage());
    }
    @ExceptionHandler
    public Result<?> error(DsException e) {
        return Result.fail(e.getMessage());
    }
    @ExceptionHandler
    public Result<?> error(EmailException e) {
        return Result.fail(e.getMessage());
    }
}
